package com.l.web.master.system.menu;

import org.l.qiao.AbstractCollectionDAO;
import org.l.qiao.Cluster;
import org.l.qiao.builder.Query;
import org.l.qiao.builder.Sort;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class MenuDAO extends AbstractCollectionDAO {

    public static final String COLLECTION = "c_menu";

    public MenuDAO() {
        super(COLLECTION);
    }

    public List<Cluster> findByParentid(String pid) {
        Query query = new Query();
        query.idEQ(Menu.PARENT_ID, pid);
        Sort sort = new Sort();
        sort.asc(Menu.INDEX);
        return this.find(query, null, sort);
    }
}